<template>
    <div class="shopping">
        <div class="switch-btn">
            <div class="btn" @click="showMarket">
                <img src="~assets/icons/credits_icon.png" alt="">
                <span>商城</span>
            </div>
            <div class="btn" @click="showCredits">
                <img src="~assets/icons/market.png" alt="">
                <span>积分</span>
            </div>
        </div>
        <div class="shopping-container">
            <store v-if="switchShopping"></store>
            <credits-store v-if="!switchShopping"></credits-store>
        </div>
    </div>
</template>

<script>
import empty from '../../public/empty'
import store from './store'
import creditsStore from './creditsStore'
import virtualData from './virtual'
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import navigation from '../../public/nav'

export default {
    name:'shopping',
    data(){
        return {
            storeList:virtualData.productList,
            realData:[],
            switchShopping:true
        }
    },
    methods:{
        showMarket(){
            this.switchShopping = true;
        },
        showCredits(){
            this.switchShopping = false;
        } 
    },
    mounted(){
        this.$store.state.tab = '购物车';
    },
    activated(){
        this.$store.state.tab = '购物车';
    },
    components:{
        empty,
        store,
        creditsStore,
        swiper,
        swiperSlide,
        navigation
    }
}
</script>

<style lang='less'>
@rem:100rem;
.shopping{
    width: 100%;
    padding-top: 168/@rem;
    .switch-btn{
        width: 100%;
        display: flex;
        position: fixed;
        left: 0;
        top: 88/@rem;
        .btn{
            width: 50%;
            height: 80/@rem;
            box-sizing: border-box;
            background: #ffffff;
            display: flex;
            align-items: center;
            justify-content: center;
            img{
                height: 36/@rem;
                width: 36/@rem;
            }
            span{
                margin-left: 10/@rem;
            }
        }
        .btn:active{
            background: #f0f0f0;
        }
        .btn:nth-of-type(1){
            border-right: 1px solid #e7e7e7;
        }
    }
    .shopping-container{
        width: 100%;
        .margin-empty{
            margin-top: 286/@rem;
        }
    }
}
</style>
